/*
 * @lc app=leetcode.cn id=283 lang=typescript
 *
 * [283] 移动零
 */

// @lc code=start
/**
 Do not return anything, modify nums in-place instead.
 */
function moveZeroes(nums: number[]): void {
    let record = 0;
    let i = 0;
    while (i < nums.length) {
        if (nums[i] === 0) {
            i++;
        } else {
            nums[record] = nums[i];
            record++;
            i++;
        }
    }
    while (record < nums.length) {
        nums[record] = 0;
        record++;
    }
}
// @lc code=end
